package cn.edu.hznu.coursework.entity;

import java.util.Calendar;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Type;

@Entity
@Table
@DynamicUpdate(true)
public class TeacherWork extends AbstractIndentifiedEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7414346851499319818L;
	
	@Column
	private String title;
	
	@Column
	@Type(type = "text")
	private String content;
	
	@Column
	private String filePath;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	private Calendar informDate;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	private Calendar deadline;
	
	@ManyToOne(fetch = FetchType.LAZY)
	private Teacher teacher;
	
	@ManyToOne(fetch = FetchType.LAZY)
	private Course course;
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "teacherWork", orphanRemoval = true)
	private List<StudentWork> sudentWorks;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public Calendar getInformDate() {
		return informDate;
	}

	public void setInformDate(Calendar informDate) {
		this.informDate = informDate;
	}

	public Calendar getDeadline() {
		return deadline;
	}

	public void setDeadline(Calendar deadline) {
		this.deadline = deadline;
	}

	public Teacher getTeacher() {
		return teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	public Course getCourse() {
		return course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	public List<StudentWork> getSudentWorks() {
		return sudentWorks;
	}

	public void setSudentWorks(List<StudentWork> sudentWorks) {
		this.sudentWorks = sudentWorks;
	}
	
}
